{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
  <div class="medium-9 columns">
    <div class="section">
      <div class="section__body">
        <form method="post">
          <div class="row">
            <div class="medium-5 columns">
              <label>
                {{ _('Title') }}
                <input name="title" placeholder="{{ _('title') }}" value="{{ tdoc['title']|default('') }}" class="textbox" autofocus>
              </label>
            </div>
          </div>
          <div class="row"><div class="columns">
            <label>
              {{ _('Introduce') }}
              <textarea name="content" class="textbox">{{ tdoc['content']|default('') }}</textarea>
              <p class="help-text">{{ _('Introduce must not exceed 500 characters and it will be shown in the list view.') }}</p>
            </label>
          </div></div>
          <div class="row"><div class="columns">
            <label>
              {{ _('Description') }}
              <textarea name="desc" class="textbox" data-markdown style="height: 200px">{{ tdoc['desc']|default('') }}</textarea>
            </label>
          </div></div>
          <div class="row"><div class="columns">
            <label>
              {{ _('Plan') }}
              <textarea name="dag" class="textbox" style="height: 500px">{% if tdoc %}{{ dag }}{% else %}{% include 'partials/training_default.json' %}{% endif %}</textarea>
            </label>
          </div></div>
          <div class="row"><div class="columns">
            <input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
          {% if page_name == 'training_edit' %}
            <button type="submit" class="rounded primary button">
              {{ _('Update') }}
            </button>
          {% else %}
            <button type="submit" class="rounded primary button">
              {{ _('Create') }}
            </button>
          {% endif %}
            <button type="button" class="rounded button" onclick="window.history.go(-1)">
              {{ _('Cancel') }}
            </button>
          </div></div>
        </form>
      </div>
    </div>
  </div>
  <div class="medium-3 columns">
    {% include 'components/md_hint.html' %}
  </div>
</div>
{% endblock %}
